package com.typing.battle.database;

import android.content.*;
import android.database.sqlite.*;
import android.database.sqlite.SQLiteDatabase.*;
import android.util.*;

public class SQLHelper extends  SQLiteOpenHelper{
	private final String TAG ="SQLHelper"; 
    private String tableName;
    private String createQuery;

	public SQLHelper(Context context, String name, CursorFactory factory,
			int version) {
		super(context, name, factory, version);
	}
	public void setDataBaseInfo(String tableName ,String createQuery) {
		this.tableName = tableName;
		this.createQuery = createQuery;
	}
	@Override
	public void onCreate(SQLiteDatabase db) {
		Log.d(TAG, "onCreate===>>");
		db.execSQL(createQuery);		
	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		Log.d(TAG, "onUpgrade===>>");
        Log.w(TAG, "Upgrading db from version" + oldVersion + " to" + 
                newVersion + ", which will destroy all old data"); 
        try {
          //  db.execSQL("DROP TABLE IF EXISTS " + DATABASE_TABLE);
            onCreate(db);
        } catch (Exception e) { e.printStackTrace(); }
    }

}
